A. Field of the Invention
The present invention relates to a method and system for rendering computer graphics display tear free, especially to a method and system which can quickly furnish information to the on-screen display by determining a safe region in real time.
B. Description of the Prior Art
xe2x80x9cFrame tearxe2x80x9d is a problem occurred in computer graphics display. It results in a flickering on the output display which is disturbing to a viewer especially when he/she is producing an animated graphical output. The problem of a frame tear occurs because the data transferred to a frame buffer is not synchronized to the scan out of the frame buffer. Refer to FIG. 1 for showing an example of a frame tear, in which the image data for the portion A comes from a frame different from the image source of the portion B. As a result, the information scanned to the output display as a single frame is actually from two sequential frames. The inconsistency between the two pictures from two sequential frames appears as a xe2x80x9ctearxe2x80x9d to the viewer.
To solve this problem, a conventional method eliminates the frame tear problem by utilizing an interrupt mechanism. In accordance with the conventional method, an interrupt is generated to signal the beginning of the safe region to start furnishing data to a frame buffer. The problem of the interrupt method is that it cannot be adapted for a command-queue-based graphics accelerative engine:. So, it cannot furnish information to the on-screen display by determining a safe region in real time. Moreover, since it must block CPU (Central Process Unit) until the beginning of the safe region is initiated, so it takes a longer time to process. As a result, its speed for transferring image data to the frame buffer is heavily dependent on the speed of the CPU.
It is an object of the present invention to provide an improved method and system which can solve the frame tear problem efficiently by determining a safe region in real time.
It is another object of the present invention to provide an improved method and system which is adaptable for a command-queue-based graphics accelerative engine, thereby to accelerate image transfer.
In accordance with the invention, an aspect of the present invention provides a method for eliminating frame tears from an output display. The method includes the following steps: (1) Determine a block transfer type for each request of an application program. The block transfer type includes a top-down block transfer type, a bottom-up block transfer type, and a direct block transfer type. (2) Send a block transfer command to a command queue in response to the determined block transfer type. (3) Determine a safe region for each of the determined block transfer command. (4) Transfer information from a source bitmap to a destination bitmap when a current scan line is within the safe region determined for the associated block transfer command.
The top-down block transfer type is determined when either one of the following conditions applies: (1) The destination bitmap is selected from a portion of the on-screen display, and the source bitmap is a part of the off-screen display. (2) Both of the destination and source bitmaps are part of the on-screen display, and the top position of the destination bitmap is at a position higher than the top position of the source bitmap. (3) Both of the destination and source bitmaps are part of the on-screen display, and the top position of the destination bitmap is at a lower position than the top position of the source bitmap, and not overlapped.
A bottom-up block transfer type is determined when all of the following conditions applies: (1) Both of the destination and source bitmaps are part of the on-screen display. (2) The top position of the destination bitmap is at a lower position than the top position of the source bitmap. (3) The destination and source bitmaps are overlapped. And (4) the height of the destination bitmap is less than half of the height of the source bitmap.
A direct block transfer is performed when the destination bitmap is not selected from the on-screen display. In that case, no frame tear problem will occur because the block transfer is performed behind the scene.
After determining the block transfer type for a request, a safe region for the determined block transfer command must be determined. Then, calculate the safe region to perform block transferring operation according to the correspondent block transfer type and current scan line position.
In another aspect of the present invention, the system of the present invention mainly includes: a graphics driver having a mechanism for determining a block transfer type in response to each request of a graphic application program. The graphics driver sends a block transfer command to a command queue in response to each determined block transfer type. The graphic driver accesses the command queue and the graphics accelerative engine receives the determined block transfer command. A scan line counter records a current position of the scan line. The graphics accelerative engine has a mechanism for determining a safe region for each of the determined block transfer command in response to the current position of the scan line. The graphics accelerative engine accesses the frame buffer and transfers information from a source bitmap to a destination bitmap when the current scan line is within the safe region for the determined block transfer command.